<template>
    <view>
        <view style="height: 28rpx"></view>

        <!-- 列表 -->
        <view class="news">
            <!-- parse <template is="tasklist" v-if="tasklist" :data="tasklist"/> -->
            <block name="tasklist" v-if="tasklist">
                <view class="joblist_2" v-for="(item, index) in tasklist" :key="index">
                    <view class="title_2" @tap="toTaskDetail" :data-id="item.id">
                        <view class="jobinfo_2">
                            <view class="jobinfoleft_2">
                                <view class="address_2">
                                    <view class="jobname_2">{{ item.title }}</view>

                                    <view class="moneyinfo_2"></view>
                                    <view class="vprice2"></view>
                                </view>

                                <view class="joblable_2">招{{ item.num }}人 | {{ item.jobtitle }}</view>
                            </view>

                            <view class="jobinforight_2">
                                <view class="fxmoney_2">
                                    <view style="width: 200rpx; color: #fff">推荐入职奖</view>
                                    <view>{{ item.money }}元</view>
                                </view>
                            </view>
                        </view>

                        <view class="detail_2">
                            <view class="info_2">
                                <view class="companyinfo_2" style="font-size: 0.9rem">
                                    {{ item.companyname }}
                                </view>
                                <view class="jobmoney_2">
                                    <view class="time_2">{{ item.createtime }}</view>
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
            </block>
        </view>
    </view>
</template>

<script>
import { Task } from '../../model/task-model.js';
var task = new Task();
import { Taskrecord } from '../../model/taskrecord-model.js';
var taskrecord = new Taskrecord();
import { Agent } from '../../model/agent-model.js';
var agent = new Agent();
export default {
    data() {
        return {
            tasklist: ''
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad: function (e) {
        var that = this;
        uni.setNavigationBarTitle({
            title: '我的任务'
        });
        var params = {};
        agent.Checkagent((data) => {
            if (data.status == 0) {
                uni.navigateTo({
                    url: '/pages/regagent/index'
                });
            } else if (data.status == 1) {
                var params = {};
                taskrecord.GetTaskRecordList((rdata) => {
                    that.setData({
                        tasklist: rdata.taskrecordlist
                    });
                }, params);
            } else {
                uni.showModal({
                    title: '提示',
                    content: data.msg,
                    showCancel: false
                });
                return;
            }
        }, params);
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {},
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {},
    methods: {
        toTaskDetail() {
            console.log('占位：函数 toTaskDetail 未声明');
        }
    }
};
</script>
<style>
@import '../templates/css/index_2.css';
</style>
